package com.ydgk.jishuzhan.dao;

import com.ydgk.jishuzhan.beans.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface UserMapper {

    User validUser(User user);

    int save(User user);


    void update(User user);

    void updatePassword(User user);

    @Select("select * from user")
    List<User> findAll();

    @Select("select * from user where id = #{userId}")
    User findUserById(Integer userId);

    @Select("select count(*) from friend where userId=#{userId} and friendId=#{friendId} ")
    int findFriend(Integer userId, Integer friendId);

    @Insert("insert into friend(userId,friendId) values(#{userId},#{friendId}")
    void guanzhu(@Param("userId") Integer userId,@Param("friendId") Integer friendId);


    List<Integer> findFriends(Map<String, Object> map);

    Integer queryFriendTotal(Map<String, Object> map);
}
